#include "parafluidcolor.h"

using namespace ParaFluid;

const Color Color::RED(1.0, 0.0, 0.0);

const Color Color::GREEN(0.0, 1.0, 0.0);

const Color Color::BLUE(0.0, 0.0, 1.0);

const Color Color::WHITE(1.0, 1.0, 1.0);

const Color Color::BLACK(0.0, 0.0, 0.0);

Color::~Color()
{
	/* does nothing */
}

Color::Color()
	: red(1.0)
	, green(1.0)
	, blue(1.0)
{
	/* does nothing */
}

Color::Color(float r, float g, float b)
	: red(r)
	, green(g)
	, blue(b)
{
	/* does nothing */
}

Color::Color(const Color & other)
	: red(other.red)
	, green(other.green)
	, blue(other.blue)
{
	/* does nothing */
}

Color & Color::operator= (const Color & rhs)
{
	if(&rhs != this)
	{
		red = rhs.red;
		green = rhs.green;
		blue = rhs.blue;
	}
	return *this;
}

bool Color::operator== (const Color & rhs) const
{
	bool result = true;
	if(&rhs != this)
	{
		result = (red == rhs.red)
		&& (green == rhs.green)
		&& (blue == rhs.blue);
	}
	return result;
}

QDataStream & operator<<(QDataStream & stream, const ParaFluid::Color & color)
{
	stream << color.red;
	stream << color.green;
	stream << color.blue;
	return stream;
}
	
QDataStream & operator>>(QDataStream & stream, ParaFluid::Color & color)
{
	stream >> color.red;
	stream >> color.green;
	stream >> color.blue;
	return stream;
}
